package cn.kgc.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.kgc.entity.Dept;
import cn.kgc.entity.Emp;
import cn.kgc.mapper.DeptMapper;
import cn.kgc.mapper.EmpMapper;
import cn.kgc.service.EmpService;

@Service
public class EmpServiceImpl implements EmpService{
	
	@Resource
	private EmpMapper empMapper;
	@Resource
	private DeptMapper deptMapper;

	@Override
	public Emp getEmpById(Integer id) {
		Emp emp=empMapper.getEmpById(id);
		System.out.println(emp);
		return emp;
	}

	@Override
	public List<Emp> getAllEmp() {
		// TODO Auto-generated method stub
		return empMapper.getAllEmp();
	}

	@Override
	public List<Dept> getAllDept() {
		// TODO Auto-generated method stub
		return deptMapper.getAllDept();
	}

	@Override
	public void addEmp(Emp emp) {
		empMapper.addEmp(emp);
		
	}

	@Override
	public void updateEmp(Emp emp) {
		empMapper.updateEmp(emp);
		
	}

	@Override
	public void deleteEmpById(Integer id) {
		empMapper.deleteEmpById(id);
		
	}

	@Override
	public Long countEmpByName(String name) {
		return empMapper.countEmpByName(name);
	}

	@Override
	public Double maxEmpSal() {
		return empMapper.maxEmpSal();
	}

}
